<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if !IE]><!-->
<html lang="zh">
<!--<![endif]-->
<head>
	<meta charset="utf-8" />
    <%@include file="common/taglib.jsp"%>
	<title>保险代理后台管理系统</title>
	<jsp:include page="common/header.jsp"/>
	<!-- begin #page-loader -->
</head>
<body>
	<div id="page-loader" class="fade in"><span class="spinner"></span></div>
	<!-- end #page-loader -->
	
	<!-- begin #page-container -->
	<div id="page-container" class="fade">
	    <!-- begin login -->
        <div class="login bg-black animated fadeInDown">
            <!-- begin brand -->
            <div class="login-header text-center" style="top: -144px;">
                <%--<div class="brand">
                    <span class="logo"></span> 保险代理
                    <small>后台管理系统</small>
                </div>--%>
                <div><img src="/static/img/sign_logo.png" alt="logo图片"></div>
                <h2>保险代理管理系统</h2>
            </div>
            <!-- end brand -->
            <div class="login-content">
                <form:form id="loginForm" action="dologin" method="POST" class="margin-bottom-0" data-parsley-validate="true">
                    <div class="form-group m-b-20">
                        <input type="text" class="form-control input-lg" placeholder="用户名" name="username" data-parsley-required="true"
                        data-parsley-required-message="用户名不能为空" value="${user.jobNumber}"/>
                       </div>
                    <div class="form-group m-b-20">
                        <input type="password" class="form-control input-lg" placeholder="密码" id="password" name="password"
                        data-parsley-required-message="密码不能为空" data-parsley-required="true" value="${user.password}"/>
                    </div>
                  
          <div class="form-inline m-b-20" style="position:relative;">
            <div class="form-group" >
               <input type="text" style="width: 220px;"  class="form-control input-lg" placeholder="验证码" id="captcha" name="captcha" data-parsley-required="true" data-parsley-required-message="验证码不能为空"/>
          
               <img style="position: absolute;top:-1px;right: 0"  src="./Kaptcha" class="form-group" alt="点击更换" id="kaptchaImage"/>
            
            </div>
         </div>
           <span style="position: relative;top: -6px;color: #E5603B;width: 100%;display: block;text-align: center;">${loginMessage.msg}</span>
                    <%--<div class="checkbox m-b-20">--%>
                        <%--<label>--%>
                            <%--<input type="checkbox" /> 记住我--%>
                        <%--</label>--%>
                    <%--</div>--%>
                    <div class="login-buttons ">
                        <button onclick="encryptInput()"  class="btn btn-danger btn-block btn-lg">登录</button>
                    </div>
                    <p class="text-center p-t-20">忘记密码请联系系统管理员!</p>
                </form:form>
            </div>
        </div>
        <!-- end login -->
	</div>
	<!-- end page container -->
	
	<!-- ================== BEGIN BASE JS ================== -->
	<script src="${ctx }/static/plugins/jquery/jquery-1.9.1.min.js"></script>
	<script src="${ctx }/static/plugins/jquery/jquery-migrate-1.1.0.min.js"></script>
	<script src="${ctx }/static/plugins/jquery-ui/ui/minified/jquery-ui.min.js"></script>
	<script src="${ctx }/static/plugins/bootstrap/js/bootstrap.min.js"></script>
	<!--[if lt IE 9]>
		<script src="static/crossbrowserjs/html5shiv.js"></script>
		<script src="static/crossbrowserjs/respond.min.js"></script>
		<script src="static/crossbrowserjs/excanvas.min.js"></script>
	<![endif]-->
	<script src="${ctx }/static/plugins/slimscroll/jquery.slimscroll.min.js"></script>
	<script src="${ctx }/static/plugins/jquery-cookie/jquery.cookie.js"></script>
    <script src="${ctx }/static/plugins/parsley/dist/parsley.js"></script>
    <script src="${ctx }/static/js/crypto-js.js"></script>
	<!-- ================== END BASE JS ================== -->
	
	<!-- ================== BEGIN PAGE LEVEL JS ================== -->
	<script src="${ctx }/static/js/apps.min.js"></script>
	<!-- ================== END PAGE LEVEL JS ================== -->
	
	<script>
		$(document).ready(function() {
			App.init();
            $('#kaptchaImage').click(function() {$(this).attr('src','Kaptcha?' + Math.floor(Math.random() * 100));});
		});

        //AES-128-CBC加密模式，key需要为16位，key和iv可以一样
        function encrypt(data) {
            var key  = CryptoJS.enc.Latin1.parse('0415f531c6e4e17b');
            var iv   = CryptoJS.enc.Latin1.parse('0415f531c6e4e17b');
            return CryptoJS.AES.encrypt(data, key, {iv:iv,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.ZeroPadding}).toString();
        }

		function encryptInput() {
            //获取用户输入值
            //var username = $("#username").val();
            var password = $("#password").val();
            //加密用户名和密码
            //username = encrypt(username);
            password = encrypt(password);
            //$("#username").val(username);
            $("#password").val(password);
            $("#loginForm").submit();
        }
    </script>
</body>
</html>
